package com.seres.frontend;

import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;

import javax.swing.GroupLayout.Alignment;

import com.seres.backend.AnswerDecision;
import com.seres.backend.CorrectiveDecision;
import com.seres.backend.Decision;
import com.seres.backend.Game;
import com.seres.backend.GameState;
import com.seres.data.Ace;
import com.seres.data.AceCategory;
import com.seres.data.Acronym;
import com.seres.data.Answer;
import com.seres.data.DataManager;
import com.seres.data.GameParameter;
import com.seres.data.GameStructure;
import com.seres.data.Index;
import com.seres.data.IndexImpact;
import com.seres.data.Scenario;
import com.seres.data.Stakeholder;
import com.seres.data.StakeholderImpact;
import com.seres.events.AcesInfoEvent;
import com.seres.events.AcronymsInfoEvent;
import com.seres.events.AiInfoEvent;
import com.seres.events.DecisionEvent;
import com.seres.events.GameStateEvent;
import com.seres.events.ModuleInfoEvent;
import com.seres.events.ScenarioInfoEvent;
import com.seres.events.StatusOverviewEvent;
import com.seres.general.EventBroker;
import com.seres.listeners.AcesInfoListener;
import com.seres.listeners.AcronymsInfoListener;
import com.seres.listeners.GameStateListener;
import com.seres.listeners.ModuleInfoListener;
import com.seres.listeners.ScenarioInfoListener;
import com.seres.listeners.StatusOverviewListener;


import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.ScaleTransition;
import javafx.animation.Timeline;
import javafx.animation.TranslateTransition;
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.event.*;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.geometry.Side;
import javafx.scene.*;
import javafx.scene.chart.BarChart;
import javafx.scene.chart.CategoryAxis;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.control.*;
import javafx.scene.effect.DropShadow;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Shape;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.util.Duration;
import jfxtras.labs.scene.control.gauge.Rater; // jfxtras library

/**
 *
 * @author brunobonte
 */

public class GameGUI extends Application implements ModuleInfoListener,ScenarioInfoListener,AcesInfoListener,AcronymsInfoListener,GameStateListener,StatusOverviewListener{
    // load custom fonts (must be located in same package as main class)
    Font gill_sans = Font.loadFont(getClass().getResource("fonts/gill_sans.TTF").toExternalForm(), 10); // 'Gill Sans MT'
    Font gill_sans_bold = Font.loadFont(getClass().getResource("fonts/gill_sans_bold.TTF").toExternalForm(), 10); // 'Gill Sans MT'
    Font gill_sans_bold_italic = Font.loadFont(getClass().getResource("fonts/gill_sans_bold_italic.TTF").toExternalForm(), 10); // 'Gill Sans MT'
    Font gill_sans_italic = Font.loadFont(getClass().getResource("fonts/gill_sans_italic.TTF").toExternalForm(), 10); // 'Gill Sans MT'
    Font rockwell = Font.loadFont(getClass().getResource("fonts/rockwell.TTF").toExternalForm(), 10); // 'Rockwell'
    Font rockwell_bold = Font.loadFont(getClass().getResource("fonts/rockwell_bold.TTF").toExternalForm(), 10); // 'Rockwell'
    Font rockwell_bold_italic = Font.loadFont(getClass().getResource("fonts/rockwell_bold_italic.TTF").toExternalForm(), 10); // 'Rockwell'
    Font rockwell_italic = Font.loadFont(getClass().getResource("fonts/rockwell_italic.TTF").toExternalForm(), 10); // 'Rockwell'
    
    private Game game;
    
    // (dynamic) attributes
    private String stageTitle = "SERES"; // window title
    
    //1280x720
    private final double sceneWidth = 1280; // screen width
    private final double sceneHeight = 720; // screen height
    
    private Label titleLabel;
//    private double scenarioWidth = 600;
//    private double scenarioHeight = 105;
    //1280x720
    private double scenarioWidth = 860;
    private double scenarioHeight = 150;
    private Scenario actualScenario;
    private List<AceCategory> aceCategories;
    private List<Acronym> acronyms;
    private int descriptionCounter;
    private double riskValue = 0.674; // results: risk score
    private double trustValue = 0.12; // results: trust score
    private double stiValue = 1.00; // results: STI score
    private XYChart.Series<Number,String> series;
    private boolean gameFinished = false;
    
    
    // UI elements
    private BorderPane containerBP; // container for title (top) - content (center) - menu (bottom)
    private Group scenarioGroup; // group container for scenario text, scenario balloon and navigation arrows
    private Label scenarioTextLabel; // label for scenario text
    private VBox answerBox; // vertical layout pane for answers options
    private VBox scenarioBox;
    public Rectangle scenarioBox1;
    private HBox menuBox; // horizontal layout pane for menu buttons
    private HBox titleBox;
    private List<Button> answerButtons = new ArrayList<Button>();
    private ToggleGroup toggleGroupAnswers;
    private ToggleGroup toggleGroupAces;
    private ToggleGroup toggleGroupRisk;
    private List<StakeholderCheckBox> stakeholderCheckBoxes;
    private Rater rater; // jfxtras library: stars for 'Aces Left'
    private Label riskLabel;
    private ImageView riskGauge;
    private Label trustLabel;
    private ImageView trustGauge;
    private Label stiLabel;
    private ImageView stiGauge;
    private List<HBox> decisionImpactBoxes;
    private Label acesLeftLabel;
    private ProgressBar progressBar;
    private Button progressButton;
    private Button actionsButton;
    private Button continueButton;
    private HBox stakeholdersAndRiskBox;
    
    // layout panes
    private StackPane scenarioAnswerPane;
    private AnchorPane startPane;
    private AnchorPane endPane = new AnchorPane();
    private StackPane actionsPane;
    private StackPane helpPane;
    private StackPane resultsPane;
  
    private Pane activePane; // to indicate which pane can be seen = which pane is on foreground
    
    // load images (results screen)
    Image img_arrow_pos = new Image(getClass().getResourceAsStream("images/arrow_pos.png"));
    Image img_arrow_neg = new Image(getClass().getResourceAsStream("images/arrow_neg.png"));
    Image img_neutral = new Image(getClass().getResourceAsStream("images/neutral.png"));   
    Image img_20percent = new Image(getClass().getResourceAsStream("images/score/20percent.png"));   
    Image img_40percent = new Image(getClass().getResourceAsStream("images/score/40percent.png"));   
    Image img_60percent = new Image(getClass().getResourceAsStream("images/score/60percent.png")); 
    Image img_80percent = new Image(getClass().getResourceAsStream("images/score/80percent.png"));
    Image img_100percent = new Image(getClass().getResourceAsStream("images/score/100percent.png"));
    
        
    private void init(Stage primaryStage) {
//        Group root = new Group();
    	
        containerBP = new BorderPane();
        containerBP.setMaxHeight(sceneHeight);
        containerBP.setMaxWidth(sceneWidth);
        containerBP.setId("containerBP");
        
        Scene scene = new Scene(containerBP, sceneWidth, sceneHeight);
//        Scene scene = new Scene(root, sceneWidth, sceneHeight);
        scene.getStylesheets().add("com/seres/frontend/css/stylesheet.css"); // load CSS stylesheet
        
        primaryStage.setResizable(false);//disable full screen
        primaryStage.centerOnScreen();
        primaryStage.setScene(scene);
        primaryStage.setTitle(stageTitle);
        //primaryStage.initStyle(StageStyle.TRANSPARENT);
        //primaryStage.getIcons().add(new Image("resources/images/icon_64x64.png"));
        //primaryStage.setFullScreen(true);
        

        
        generateStartScreen();
        generateEndScreen();
        activatePane(getStartPane());
        
//        closeActivePane();
//        activatePane(getEndPane());
        
        // add container BorderPane to the root node
//        root.getChildren().add(containerBP);
        
    }
    
    private void closeActivePane(){
    	if(getActivePane() != null){
    		getContainerBP().getChildren().remove(getActivePane());
    		getContainerBP().setCenter(null);
    	}
    }
    private void activatePane(Pane pane){
    	getContainerBP().setCenter(pane);
    	setActivePane(pane);
    }
    
    /* --- methods for generating UI elements and other screens --- */
    private void generateStartScreen(){
    	setStartPane(new AnchorPane());
    	
    	changeBackground("images/", "117.jpg");
    	//1280x720
//    	changeBackground("images1280x720/", "117.jpg");
    	
    	//INTRO TEXT
    	int scenarioBoxWidth = 800;
    	int scenarioBoxHeight = 280;
    	
        Group scenarioGroup = new Group();
        scenarioGroup.setId("scenarioGroup");
        
        Rectangle scenarioBox = new Rectangle(0,0,scenarioBoxWidth,scenarioBoxHeight); // Rectangle(x,y,width,height)
        scenarioBox.setArcWidth(30);
        scenarioBox.setArcHeight(30);
        
        Polygon scenarioBoxTail = new Polygon(new double[]{
            100 , scenarioBoxHeight ,
            250 , scenarioBoxHeight ,
            50, 310});

        // union function which combines any two shapes
        Shape scenarioBalloon = Shape.union(scenarioBox, scenarioBoxTail);
        scenarioBalloon.setFill(Color.WHITE);

        final DropShadow dropShadow = new DropShadow();
        dropShadow.setOffsetX(3.0);
        dropShadow.setOffsetY(3.0);
        dropShadow.setRadius(5.0);
        dropShadow.setColor(Color.web("#000000", 0.5));
        scenarioBalloon.setEffect(dropShadow);

        Label startTextLabel = new Label();
        startTextLabel.setPrefSize(scenarioBoxWidth, scenarioBoxHeight);
        startTextLabel.setWrapText(true);
        startTextLabel.setAlignment(Pos.CENTER);
        startTextLabel.setId("introTextLabel");
        startTextLabel.setText("Welcome to the SERES Game! \n\n You will be guided through a range of scenarios that reflect situations " +
        		"you may encounter in your day-to-day job. Throughout the game, you will be asked to make decisions. Each decision will " +
        		"impact others around you in different ways. We call these your “stakeholders”. They include your boss, colleagues, payers, " +
        		"patients, KOLs, physicians, the press and regulators. Each decision also carries a certain compliance “risk”: some are low risk, " +
        		"others high. The goal of the game is to make decisions that best balance the impact on your stakeholders whilst keeping your " +
        		"compliance risk level low. \n\n To start the first scenario, press “Play”. Click the arrows in the text-balloon to progress through " +
        		"the scenario. At the end of each scenario, you will be asked to make a decision on how to proceed. Up to 3 options will appear " +
        		"on screen. Tick the button of the option of your choice and press “Confirm” in the navigation-bar. To view your scores throughout " +
        		"the game, press “Results”. At any point during the game, you can take up to 3 “corrective actions” to try and improve your results. " +
        		"Click “Actions” to see the options available to you. For help with abbreviations or instructions on how to play, click “?”. \n\n" +
        		"Good luck!");
        
        StackPane stack = new StackPane();
        stack.getChildren().addAll(scenarioBalloon, startTextLabel);
        
        scenarioGroup.getChildren().addAll(stack);
        
        AnchorPane.setTopAnchor(scenarioGroup, Double.valueOf(20));
        AnchorPane.setLeftAnchor(scenarioGroup, Double.valueOf(180));
        
        getStartPane().getChildren().addAll(scenarioGroup);
    	
    	//PLAY button
        Button button = ButtonBuilder.create()
        .text("PLAY")
        .onAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent t) {            
              
              initGame();
            	
            	//// TOP content ////
              
              generateTitleBox();
                     
              //// BOTTOM content ////
              
              // generate menubar
              generateMenuBar();
              
              // generate content panes
              generateHelp();
              generateActions();
              generateResults();
              generateScenarioAndAnswers();
              
              getGame().recoverOldGameState();
              

              askForNextAction();
              askForStatusOverview();//initialiseren progress bar
              
              closeActivePane();
              activatePane(getScenarioAnswerPane());
            }

        })
        .build();

        button.getStyleClass().add("playButton");
        
//        button.setMinHeight(Double.valueOf(115));
//        button.setMinWidth(Double.valueOf(115));
//        button.setLayoutX(896d);
//        button.setLayoutY(425d);
        //1280x720
        button.setMinHeight(Double.valueOf(135));
        button.setMinWidth(Double.valueOf(135));
        button.setLayoutX(1036d);
        button.setLayoutY(488d);
        
        getStartPane().getChildren().add(button);

    }
    private void generateEndScreen(){
//    	int scenarioBoxWidth = 600;
    	//1280x720
    	int scenarioBoxWidth = 850;
    	int scenarioBoxHeight = 230;
    	
        Group scenarioGroup = new Group();
        scenarioGroup.setId("scenarioGroup");
        
        Rectangle scenarioBox = new Rectangle(0,0,scenarioBoxWidth,scenarioBoxHeight); // Rectangle(x,y,width,height)
        scenarioBox.setArcWidth(30);
        scenarioBox.setArcHeight(30);
        
        Polygon scenarioBoxTail = new Polygon(new double[]{
            100 , scenarioBoxHeight ,
            250 , scenarioBoxHeight ,
            50, 135+125});

        // union function which combines any two shapes
        Shape scenarioBalloon = Shape.union(scenarioBox, scenarioBoxTail);
        scenarioBalloon.setFill(Color.WHITE);

        final DropShadow dropShadow = new DropShadow();
        dropShadow.setOffsetX(3.0);
        dropShadow.setOffsetY(3.0);
        dropShadow.setRadius(5.0);
        dropShadow.setColor(Color.web("#000000", 0.5));
        scenarioBalloon.setEffect(dropShadow);

        Label endTextLabel = new Label();
        endTextLabel.setPrefSize(scenarioBoxWidth, scenarioBoxHeight);
        endTextLabel.setWrapText(true);
        endTextLabel.setAlignment(Pos.CENTER);
        endTextLabel.setId("endTextLabel");
        endTextLabel.setText("Congratulations to the Teams who realized positive scores at this point. To ALL: in this game " +
        		"“there are no winners or losers” but the discussions and impact of your decisions you have experienced throughout " +
        		"the game should be the learning. If you can take this back in your day to day decision making and influencing, " +
        		"the ISMS HCC Change Management Game will have been fruitful. What happens in the field does not always correspond " +
        		"with potentially right decisions taken in grey areas. In practice: insignificant oversights, calculated risks, " +
        		"unforeseen interactions not surfacing unpleasant issues, not immediately solving these in spite of negative impact " +
        		"on short term business, being hesitant for unpopular standpoints, recommendations and decisions, etc.. may fire back. " +
        		"Sometimes with major consequences. Having “what if” crisis scenarios (based on pro-active, specific risk assessments) " +
        		"in place can make the difference when the “impossible” becomes reality...");
        
        StackPane stack = new StackPane();
        stack.getChildren().addAll(scenarioBalloon, endTextLabel);
        
        scenarioGroup.getChildren().addAll(stack);
        
        AnchorPane.setTopAnchor(scenarioGroup, Double.valueOf(50));
        AnchorPane.setLeftAnchor(scenarioGroup, Double.valueOf(180));
        
        getEndPane().getChildren().addAll(scenarioGroup);
        
    }
    private void generateScenarioAndAnswers(){
    	setScenarioAnswerPane(new StackPane());

        // scenario
        generateScenarioBox(scenarioWidth, scenarioHeight);
        
        // answers
        setAnswerBox(new VBox());
        getAnswerBox().setMaxSize(0, 0);
        getAnswerBox().setSpacing(5);
//        getAnswerBox().setFillWidth(true);
        getAnswerBox().setPadding(new Insets(3, 10, 5, 15));
        getAnswerBox().setAlignment(Pos.TOP_RIGHT);
        
        setScenarioBox(new VBox());
        getScenarioBox().setPadding(new Insets(10, 10, 5, 20));
        getScenarioBox().getChildren().add(scenarioGroup);
        StackPane.setAlignment(getAnswerBox(), Pos.TOP_RIGHT);
        getScenarioAnswerPane().getChildren().add(getScenarioBox());
        getScenarioAnswerPane().getChildren().add(getAnswerBox());
    }
    private void generateMenuBar(){
        setMenuBox(new HBox());
        getMenuBox().setAlignment(Pos.BOTTOM_LEFT);
        getMenuBox().setPrefHeight(35);
        getMenuBox().setSpacing(3);
        menuBox.setPrefWidth(sceneWidth);
        getMenuBox().setPadding(new Insets(0, 40, 0, 40)); // top, right, bottom, left
        
        generateMenuButton("RESULTS",new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent t) {
            	askForStatusOverview();
            	closeActivePane();
            	activatePane(getResultsPane());
            	getContinueButton().setVisible(true);
            }

        });
        generateMenuButton("?",new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent t) {           
            	closeActivePane();
            	activatePane(getHelpPane());
            	
            }

        });

        generateMenuButton("START",new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent t) {
            	if(!gameFinished){
//                	Button b = (Button) t.getSource();
//                	b.setText("CONFIRM");
                	
                	if(getActivePane() == getActionsPane()){
//                		if(getToggleGroupAces().getSelectedToggle() != null){
//                			AceButton ab = (AceButton) getToggleGroupAces().getSelectedToggle();
////                			System.out.println("GameGUI Ace: " + ab.getAce().getShortDescription());
//                			CorrectiveDecision decision = new CorrectiveDecision(ab.getAce());
//                			registerDecision(decision);
//                			ab.setDisable(true);
//                		}
                	}
                	else if(getActivePane() == getScenarioAnswerPane()){
                    	if(!getActualScenario().getQuestion().equals("")){
//                        	if(getToggleGroupAnswers().getSelectedToggle() != null){
//                            	AnswerButton ab = (AnswerButton) getToggleGroupAnswers().getSelectedToggle();
////                            	System.out.println("GameGUI: " + ab.getAnswer().getFullDescription());
//                            	AnswerDecision decision = new AnswerDecision(ab.getAnswer());
//                            	registerDecision(decision);
////                            	askForStatusOverview();
//                            	removeExistingAnswerButtons();
//                            	askForNextAction();
//                            	
//                        	}
                    	}
                    	else{
                    		if(isValidStakeholdersAndRiskChoice()){
	                        	// leeg antwoord & decision als tijdelijke workaround om scenario zonder antwoord op te vangen
	                    		ArrayList<IndexImpact> indexImpacts = new ArrayList<IndexImpact>();
	//                    		indexImpacts.add(new IndexImpact(0,Index.RISK));
	                    		//new implementation due to database changes for class stakeholder and indices
	                    		for(Index i : getGame().getIndices()){
	                    			indexImpacts.add(new IndexImpact(0, i));
	                    		}
	                    		
	                    		ArrayList<StakeholderImpact> stakeholderImpacts = new ArrayList<StakeholderImpact>();
	
	                    		for(Stakeholder s: getGame().getStakeholders()){
	                    			stakeholderImpacts.add(new StakeholderImpact(0, s));
	                    		}
	                    		
	                        	Answer answer = new Answer("","",indexImpacts,stakeholderImpacts,false,false,null);
	                        	AnswerDecision decision = new AnswerDecision(answer);
	                        	registerDecision(decision);
	                        	
	                        	
	                            	sendAiInfo();
	                            	removeStakeholdersAndRiskBox();
	                        	
	
	                        	
	                        	askForNextAction();
	                        	askForStatusOverview();
	                        	
	                        	Button b = (Button) t.getSource();                        	
	                            getMenuBox().getChildren().remove(b);
                    		}
                    	}	
                	}
            	}



            }


        });

        
        // generate progressbar
        generateProgressBar();
        
        setContinueButton(generateMenuButton("CONTINUE",new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent t) {           
            	closeActivePane();
            	activatePane(getScenarioAnswerPane());
            	getContinueButton().setVisible(false);
            }

        }));
        HBox.setMargin(getContinueButton(),new Insets(0, 0, 0, 250));
        getContinueButton().setVisible(false);
        Tooltip continueTooltip = new Tooltip("Click here to continue to the next \nscenario. You can always go back \nand review your results later.");
        continueTooltip.getStyleClass().add("tooltip");
        getContinueButton().setTooltip(continueTooltip);
        
        containerBP.setBottom(getMenuBox());
    }
    private void generateTitleBox() {
        setTitleLabel(new Label());
                
        setTitleBox(new HBox());
        getTitleBox().setAlignment(Pos.BOTTOM_LEFT);
        getTitleBox().setPrefHeight(35);
        getTitleBox().setPrefWidth(sceneWidth);
        getTitleBox().setPadding(new Insets(10, 0, 0, 15)); // Insets(top, right, bottom, left)
        getTitleBox().setId("titleBox");
        getTitleBox().getChildren().addAll(getTitleLabel());
        
        getContainerBP().setTop(getTitleBox());
    }
    private void removeTitleBox(){
    	getContainerBP().getChildren().remove(getTitleBox());
    }
    
    private void generateScenarioBox(double scenarioBoxWidth, double scenarioBoxHeight) {
        scenarioGroup = new Group();
        scenarioGroup.setId("scenarioGroup");
        
        scenarioBox1 = new Rectangle(0,0,scenarioBoxWidth,scenarioBoxHeight); // Rectangle(x,y,width,height)
        scenarioBox1.setArcWidth(30);
        scenarioBox1.setArcHeight(30);
        
//        Polygon scenarioBoxTail = new Polygon(new double[]{
//            100 , scenarioBoxHeight ,
//            250 , scenarioBoxHeight ,
//            50, 135,});
        //1280x720
        Polygon scenarioBoxTail = new Polygon(new double[]{
                100 , scenarioBoxHeight ,
                250 , scenarioBoxHeight ,
                50, 180,});

        // union function which combines any two shapes
        Shape scenarioBalloon = Shape.union(scenarioBox1, scenarioBoxTail);
        scenarioBalloon.setFill(Color.WHITE);

        final DropShadow dropShadow = new DropShadow();
        dropShadow.setOffsetX(3.0);
        dropShadow.setOffsetY(3.0);
        dropShadow.setRadius(5.0);
        dropShadow.setColor(Color.web("#000000", 0.5));
        scenarioBalloon.setEffect(dropShadow);

        setScenarioTextLabel(new Label());
        getScenarioTextLabel().setPrefSize(scenarioBoxWidth, scenarioBoxHeight);
        getScenarioTextLabel().setWrapText(true);
        getScenarioTextLabel().setAlignment(Pos.CENTER);
        getScenarioTextLabel().setId("scenarioTextLabel");
        
        // pijltjes
        Polygon navLeft = new Polygon(new double[]{
            (scenarioBoxWidth-37) , (scenarioBoxHeight-7) ,
            (scenarioBoxWidth-37) , (scenarioBoxHeight-27) ,
            (scenarioBoxWidth-57) , (scenarioBoxHeight-17) ,
        });
        navLeft.setFill(Color.web("#1e90ff"));
        navLeft.setId("arrow");
        
        Polygon navRight = new Polygon(new double[]{
            (scenarioBoxWidth-30) , (scenarioBoxHeight-7) ,
            (scenarioBoxWidth-30) , (scenarioBoxHeight-27) ,
            (scenarioBoxWidth-10) , (scenarioBoxHeight-17) ,
        });
        navRight.setFill(Color.web("#1e90ff"));
        navRight.setId("arrow");
        
        // -------- TEST events -------- //
        navLeft.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent t) {
                displayPreviousDescriptionAndImage();
                displayStakeholdersAndRiskBox();
            } 
        });
        
        navRight.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent t) {
            	displayNextDescriptionAndImage();
            	displayStakeholdersAndRiskBox();
            }
        });
        // --------------------------- //
        
        StackPane stack = new StackPane();
        stack.getChildren().addAll(scenarioBalloon, getScenarioTextLabel());
        stack.setAlignment(getScenarioTextLabel(), Pos.TOP_CENTER);
        
        scenarioGroup.getChildren().addAll(stack, navLeft, navRight);
        
        // scenario textarea
        /*
        TextArea scenarioTextArea = new TextArea();
        scenarioTextArea.setPrefSize(scenarioBoxWidth, scenarioBoxHeight);
        scenarioTextArea.setPrefRowCount(4);
        scenarioTextArea.setWrapText(true);
        scenarioTextArea.setEditable(false);
        scenarioTextArea.setText(scenarioText);
        scenarioTextArea.setId("scenarioTextArea");
        
        scenarioGroup.getChildren().addAll(scenarioBalloon, scenarioTextArea);
        */
    }
    
    private Button generateAnswerButton(Answer answer, ToggleGroup toggleGroup) {
        final AnswerButton rb = new AnswerButton(answer);
        rb.setToggleGroup(toggleGroup);
        rb.setWrapText(true);
        rb.getStyleClass().add("answerRadioButton");
        rb.setOnAction(new EventHandler<ActionEvent>(){
    
        	@Override
        	public void handle(ActionEvent arg0) {
        		final Stage myDialog = new Stage();
        		myDialog.initModality(Modality.WINDOW_MODAL);
        		Button okButton = new Button("OK");
        		okButton.setOnAction(new EventHandler<ActionEvent>(){
                    @Override
                    public void handle(ActionEvent arg0) {
                        myDialog.close();
                        
                    	AnswerButton ab = (AnswerButton) getToggleGroupAnswers().getSelectedToggle();
//                    	System.out.println("GameGUI: " + ab.getAnswer().getFullDescription());
                    	AnswerDecision decision = new AnswerDecision(ab.getAnswer());
                    	registerDecision(decision);
                    	
                    	removeExistingAnswerButtons();
                    	askForNextAction();
                    	askForStatusOverview();
                    	
                    	closeActivePane();
                    	activatePane(getResultsPane());
                    	getContinueButton().setVisible(true);
                    	
//                    	getActionsButton().setVisible(true);
                    }
                });
        		Button cancelButton = new Button("CANCEL");
        		cancelButton.setOnAction(new EventHandler<ActionEvent>(){
                    @Override
                    public void handle(ActionEvent arg0) {
                        rb.setSelected(false);
                    	myDialog.close();
                    }
                });
        		HBox box = new HBox();
        		box.setSpacing(10);
        		box.setPadding(new Insets(25,0,0,0));
        		box.getChildren().addAll(okButton,cancelButton);
                Scene myDialogScene = new Scene(VBoxBuilder.create()
                        .children(new Text("Are you sure?"), box)
                        .alignment(Pos.CENTER)
                        .padding(new Insets(10))
                        .build());
              
                myDialog.setScene(myDialogScene);
                myDialog.show();
        	}
                  
        });
             
        final Button answerButton = new Button("", rb);
        answerButton.setMinSize(350, 195);
        answerButton.setWrapText(true);
        answerButton.setMaxWidth(350);
        answerButton.getStyleClass().add("answerButton");
        answerButton.setOnMouseEntered(new EventHandler<MouseEvent>() {

			@Override
			public void handle(MouseEvent arg0) {
		        rb.getStyleClass().clear();
		        rb.getStyleClass().add("answerRadioButtonStretched");
		        final Timeline timeline = new Timeline();
		        timeline.setCycleCount(1);
//		        timeline.setAutoReverse(true);
		        final KeyValue kv = new KeyValue(answerButton.minWidthProperty(), sceneWidth-50);
//		        final KeyValue kv1 = new KeyValue(rb.fontProperty(), Font.font(rb.getFont().getFamily(), 30));
//		        final KeyValue kv1 = new KeyValue(answerButton.translateXProperty(), -(sceneWidth-20-answerButton.getWidth())/2);
		        final KeyFrame kf = new KeyFrame(Duration.millis(1000), kv);
		        timeline.getKeyFrames().addAll(kf);
		        timeline.play();
			}
		});
        answerButton.setOnMouseExited(new EventHandler<MouseEvent>() {

			@Override
			public void handle(MouseEvent arg0) {
				rb.getStyleClass().clear();
				rb.getStyleClass().add("answerRadioButton");
		        final Timeline timeline = new Timeline();
		        timeline.setCycleCount(1);
		        final KeyValue kv = new KeyValue(answerButton.minWidthProperty(), 350);
		        final KeyFrame kf = new KeyFrame(Duration.millis(1000), kv);
		        timeline.getKeyFrames().addAll(kf);
		        timeline.play();
			}
		});
        answerButton.setOnMouseClicked(new EventHandler<MouseEvent>() {

			@Override
			public void handle(MouseEvent arg0) {
				rb.setSelected(true);
				rb.fireEvent(new ActionEvent());
			}
				
		});
        
        getAnswerButtons().add(answerButton);
        
        return answerButton;
    }
    
    private Button generateMenuButton(String text, EventHandler<ActionEvent> eh) {

        Button button = ButtonBuilder.create()
                .text(text)
                .onAction(eh)
                .build();
        
        button.getStyleClass().add("menuButton");
        if(text.toLowerCase().equals("start")){
        	button.setId("startButton");
        }
        
        getMenuBox().getChildren().add(button);
        return button;
    }
    
    private void removeMenuBar() {
    	getContainerBP().getChildren().remove(getMenuBox());
    }
    
    private void generateProgressBar() {
        setProgressBar(new ProgressBar());
        getProgressBar().setProgress(0);
        getProgressBar().setPrefWidth(100);
        getProgressBar().setId("progressBar");
        
        setProgressButton(new Button("Mini-game x of y  ", getProgressBar()));
        getProgressButton().setContentDisplay(ContentDisplay.RIGHT);
        getProgressButton().setId("progressButton");
       
        HBox.setMargin(getProgressButton(), new Insets(0, 0, 0, 150));
                
        getMenuBox().getChildren().add(getProgressButton());
    }

    
    /* CORRECTIVE ACTIONS */
    private void generateActions() {
    	setActionsPane(new StackPane());
        getActionsPane().setId("actionsPane"); // action window container
        getActionsPane().setPadding(new Insets(10,40,10,40)); // margins for the action window (top,right,bottom,left)
        
        VBox actionsWindow = new VBox(); // popup window: container for title bar + explanation + actions
        actionsWindow.getStyleClass().add("popupWindow");
        
        // titlebar
        Button actionsTitleBar = ButtonBuilder.create()
            	.text("CORRECTIVE ACTIONS (ACES)")
            	.onAction(new EventHandler<ActionEvent>() {
    	            @Override
    	            public void handle(ActionEvent t) {
    	            	closeActivePane();
    	            	activatePane(getScenarioAnswerPane());
    	            }

            	})
            	.build();
        
        actionsTitleBar.setPrefWidth(Double.MAX_VALUE); // set width to width of parent (stretch in available space)
        actionsTitleBar.getStyleClass().add("windowTitleBar");
        
        // explanation
        Label actionsComment = new Label("You can choose maximum " + GameParameter.getMaxNrOfAcesPerGame() + " Corrective Actions.\nSelect the action you wish to activate and press 'Confirm'.");
        actionsComment.setId("actionsComment");
        
        // actions        
        HBox actionsBox = new HBox(); // to position 3 columns next to each other
        actionsBox.setAlignment(Pos.TOP_CENTER);
        actionsBox.setSpacing(15);
        
        setToggleGroupAces(new ToggleGroup());
        
        askForCorrectiveActions();
        
        // column 1
        VBox actionsColumn1 = new VBox();
//        actionsColumn1.setPrefWidth(325);
        //1280x720
        actionsColumn1.setPrefWidth(375);
        actionsColumn1.setSpacing(5);
        
//        Label internalFocusLabel = new Label("Internal Focus");
        Label internalFocusLabel = new Label(getAceCategories().get(0).getCategoryName());
//        internalFocusLabel.setPrefWidth(325);
      //1280x720
        internalFocusLabel.setPrefWidth(375);
        internalFocusLabel.setTextAlignment(TextAlignment.CENTER);
        internalFocusLabel.getStyleClass().add("columnLabel");
        
        Button intAction1 = generateActionButton(getAceCategories().get(0).getAces().get(0), getToggleGroupAces()); 
        Button intAction2 = generateActionButton(getAceCategories().get(0).getAces().get(1), getToggleGroupAces()); 
        Button intAction3 = generateActionButton(getAceCategories().get(0).getAces().get(2), getToggleGroupAces()); 

        actionsColumn1.getChildren().addAll(internalFocusLabel, intAction1, intAction2, intAction3);
        
        // column 2
        VBox actionsColumn2 = new VBox();
//        actionsColumn2.setPrefWidth(325);
      //1280x720
        actionsColumn2.setPrefWidth(375);
        actionsColumn2.setSpacing(10);
        
//        Label externalFocusLabel = new Label("External Focus");
        Label externalFocusLabel = new Label(getAceCategories().get(1).getCategoryName());
//        externalFocusLabel.setPrefWidth(325);
      //1280x720
        externalFocusLabel.setPrefWidth(375);
        externalFocusLabel.getStyleClass().add("columnLabel");
        
        Button extAction1 = generateActionButton(getAceCategories().get(1).getAces().get(0), getToggleGroupAces()); 
        Button extAction2 = generateActionButton(getAceCategories().get(1).getAces().get(1), getToggleGroupAces()); 
        Button extAction3 = generateActionButton(getAceCategories().get(1).getAces().get(2), getToggleGroupAces()); 

        actionsColumn2.getChildren().addAll(externalFocusLabel, extAction1, extAction2, extAction3);
        // column 3
        VBox actionsColumn3 = new VBox();
//        actionsColumn3.setPrefWidth(325);
      //1280x720
        actionsColumn3.setPrefWidth(375);
        actionsColumn3.setSpacing(10);
        
//        Label riskLabel = new Label("Risk");
        Label riskLabel = new Label(getAceCategories().get(2).getCategoryName());
//        riskLabel.setPrefWidth(325);
      //1280x720
        riskLabel.setPrefWidth(375);
        riskLabel.getStyleClass().add("columnLabel");
        
        Button riskAction1 = generateActionButton(getAceCategories().get(2).getAces().get(0), getToggleGroupAces()); 
        Button riskAction2 = generateActionButton(getAceCategories().get(2).getAces().get(1), getToggleGroupAces()); 
        Button riskAction3 = generateActionButton(getAceCategories().get(2).getAces().get(2), getToggleGroupAces()); 
        
        actionsColumn3.getChildren().addAll(riskLabel, riskAction1, riskAction2, riskAction3);
        
        
        actionsBox.getChildren().addAll(actionsColumn1, actionsColumn2, actionsColumn3);
        
        actionsWindow.getChildren().addAll(actionsTitleBar, actionsComment, actionsBox);
        actionsWindow.setAlignment(Pos.TOP_CENTER);
        
        getActionsPane().getChildren().add(actionsWindow);
    }
    
    private Button generateActionButton(Ace ace, ToggleGroup toggleGroup) {
//    	RadioButton rb = new RadioButton(actionTitle);
    	AceButton rb = new AceButton(ace);
        rb.setToggleGroup(toggleGroup);
        rb.setWrapText(true);
        rb.setMaxWidth(320d);
        rb.getStyleClass().add("actionRadioButton");
        rb.setOnAction(new EventHandler<ActionEvent>(){
            
        	@Override
        	public void handle(ActionEvent arg0) {
        		final Stage myDialog = new Stage();
        		myDialog.initModality(Modality.WINDOW_MODAL);
        		Button okButton = new Button("OK");
        		okButton.setOnAction(new EventHandler<ActionEvent>(){
                    @Override
                    public void handle(ActionEvent arg0) {
                        myDialog.close();
                        
            			AceButton ab = (AceButton) getToggleGroupAces().getSelectedToggle();
////        			System.out.println("GameGUI Ace: " + ab.getAce().getShortDescription());
            			CorrectiveDecision decision = new CorrectiveDecision(ab.getAce());
            			registerDecision(decision);
            			ab.setDisable(true);
                    	
            			askForStatusOverview();
                    	closeActivePane();
                    	activatePane(getResultsPane());
                    	getContinueButton().setVisible(true);
                    	
//                    	getActionsButton().setVisible(false);
                    }
                });
        		Button cancelButton = new Button("CANCEL");
        		cancelButton.setOnAction(new EventHandler<ActionEvent>(){
                    @Override
                    public void handle(ActionEvent arg0) {
                        myDialog.close();
                    }
                });
        		HBox box = new HBox();
        		box.setSpacing(10);
        		box.setPadding(new Insets(25,0,0,0));
        		box.getChildren().addAll(okButton,cancelButton);
                Scene myDialogScene = new Scene(VBoxBuilder.create()
                        .children(new Text("Are you sure?"), box)
                        .alignment(Pos.CENTER)
                        .padding(new Insets(10))
                        .build());
              
                myDialog.setScene(myDialogScene);
                myDialog.show();
        	}
                  
        });
                
        Button actionButton = new Button(ace.getFullDescription(), rb);
//        actionButton.setPrefHeight(150d);
        //1280x720
        actionButton.setPrefHeight(160d);
//        Button actionButton = new Button(actionText);
        actionButton.setWrapText(true);
        actionButton.setContentDisplay(ContentDisplay.TOP); // display radiobutton + action title on top of action text
        actionButton.getStyleClass().add("actionButton");
        
        return actionButton;
    }
    
    /* HELP */
    private void generateHelp() {
    	setHelpPane(new StackPane());
        getHelpPane().setId("helpPane"); // help window container
        getHelpPane().setPadding(new Insets(10,40,10,40)); // margins for the help window (top,right,bottom,left)
        
        VBox helpWindow = new VBox(); // popup window: container for title bar + help
        helpWindow.getStyleClass().add("popupWindow");
        
        // titlebar
        Button helpTitleBar = ButtonBuilder.create()
        	.text("HELP SECTION")
        	.onAction(new EventHandler<ActionEvent>() {
	            @Override
	            public void handle(ActionEvent t) {
	            	closeActivePane();
	            	activatePane(getScenarioAnswerPane());
	            }

        	})
        	.build();
        helpTitleBar.setPrefWidth(Double.MAX_VALUE); // set width to width of parent (stretch in available space)
        helpTitleBar.getStyleClass().add("windowTitleBar");
        
        // help section        
        HBox helpBox = new HBox(); // to position 2 columns next to each other
        helpBox.setAlignment(Pos.TOP_CENTER);
        helpBox.setSpacing(25);
        helpBox.setPadding(new Insets(25,0,5,0)); // space between title bar and content
        
        // column 1
        VBox helpColumn1 = new VBox();
//        helpColumn1.setPrefWidth(525);
      //1280x720
        helpColumn1.setPrefWidth(625);
        helpColumn1.setSpacing(10);
        
        Label acronymsLabel = new Label("Acronyms");
//        acronymsLabel.setPrefWidth(525);
        //1280x720
        acronymsLabel.setPrefWidth(625);
        acronymsLabel.setTextAlignment(TextAlignment.CENTER);
        acronymsLabel.getStyleClass().add("columnLabel");
        
        askForAcronyms();
        
       // acronyms table
            GridPane grid1 = new GridPane();
            grid1.setId("acronymsGrid");
            grid1.setHgap(50);
            grid1.setVgap(5);
            grid1.setPadding(new Insets(5, 0, 5, 10));
            //grid1.setGridLinesVisible(true); //set to false to erase grid lines
            ObservableList<Node> tableContent = grid1.getChildren();
            
            for(int i = 0; i < getAcronyms().size(); i++){
                Label acronym1 = new Label(getAcronyms().get(i).getAbbreviation());
                GridPane.setConstraints(acronym1, 0, i);
                tableContent.add(acronym1);
                
                Label meaning1 = new Label(getAcronyms().get(i).getDescription());
                GridPane.setConstraints(meaning1, 1, i);
                tableContent.add(meaning1);
            }
            
        helpColumn1.getChildren().addAll(acronymsLabel, grid1);
        
        // column 2
        VBox helpColumn2 = new VBox();
//        helpColumn2.setPrefWidth(425);
      //1280x720
        helpColumn2.setPrefWidth(525);
        helpColumn2.setSpacing(10);
        
        Label instructionsLabel = new Label("Instructions");
//        instructionsLabel.setPrefWidth(425);
      //1280x720
        instructionsLabel.setPrefWidth(525);
        instructionsLabel.setTextAlignment(TextAlignment.CENTER);
        instructionsLabel.getStyleClass().add("columnLabel");
        
        Text instructionTextTitle1 = new Text("Objective of the game");
        instructionTextTitle1.getStyleClass().add("instructionTitle");
        Text instructionText1 = new Text("You will be guided through a range of situations you may encounter in your day-to-day job. You will be asked to make decisions. Each decision will impact others around you in different ways. We call these your “stakeholders”. They include your boss, peers, payers, patients, KOLs, the press and regulators. Each decision also has a specific level of compliance “risk”. The goal of the game is to make decisions that best balance the impact on your stakeholders whilst keeping your compliance risk level low.");
//        instructionText1.setWrappingWidth(425);
      //1280x720
        instructionText1.setWrappingWidth(525);
        instructionText1.getStyleClass().add("instructionText");
        
        Text instructionTextTitle2 = new Text("How to play");
        instructionTextTitle2.getStyleClass().add("instructionTitle");
        Text instructionText2 = new Text("Use the arrows in the text-balloon to progress through the scenario. At the end of each scenario, up to 3 possible decision-options will appear on screen. Tick the white button of the option that best suits how you want to proceed, and click “Confirm” in the menubar. To view your scores throughout the game, click “Results”. To take a corrective action, click “Actions” to see your options.");
//        instructionText2.setWrappingWidth(425);
      //1280x720
        instructionText2.setWrappingWidth(525);
        instructionText2.getStyleClass().add("instructionText");
        
        helpColumn2.getChildren().addAll(instructionsLabel, instructionTextTitle1, instructionText1, instructionTextTitle2, instructionText2);
        
        
        helpBox.getChildren().addAll(helpColumn1, helpColumn2);
        
        helpWindow.getChildren().addAll(helpTitleBar, helpBox);
        helpWindow.setAlignment(Pos.TOP_CENTER);
        
        getHelpPane().getChildren().add(helpWindow);
    }
    
    /* RESULTS */
    private void generateResults() {
    	setResultsPane(new StackPane());
        getResultsPane().setId("resultsPane"); // results window container
        getResultsPane().setPadding(new Insets(10,40,10,40)); // margins for the results window (top,right,bottom,left)
        
        VBox resultsWindow = new VBox(); // popup window: container for title bar + help
        resultsWindow.getStyleClass().add("popupWindow");
        
        // titlebar
        Button resultsTitleBar = ButtonBuilder.create()
            	.text("RESULTS")
//            	.onAction(new EventHandler<ActionEvent>() {
//    	            @Override
//    	            public void handle(ActionEvent t) {
//    	            	closeActivePane();
//    	            	activatePane(getScenarioAnswerPane());
//    	            }
//
//            	})
            	.build();
        
        resultsTitleBar.setPrefWidth(Double.MAX_VALUE); // set width to width of parent (stretch in available space)
        resultsTitleBar.getStyleClass().add("resultsTitleBar");
        
        // results        
        HBox resultsBox = new HBox(); // to position 2 columns next to each other
        resultsBox.setAlignment(Pos.TOP_CENTER);
        resultsBox.setSpacing(25);
        resultsBox.setPadding(new Insets(25,0,5,0)); // space between title bar and content
        
        // column 1
        VBox resultsColumn1 = new VBox();
//        resultsColumn1.setPrefWidth(600);
        //1280x720
        resultsColumn1.setPrefWidth(700);
        resultsColumn1.setSpacing(10);
        
        // STATUS
        Label statusLabel = new Label("Status of the Stakeholder Opinions");
//        statusLabel.setPrefWidth(600);
        //1280x720
        statusLabel.setPrefWidth(700);
        statusLabel.setTextAlignment(TextAlignment.CENTER);
        statusLabel.getStyleClass().add("columnLabel");
        
        // chart
        final NumberAxis statusX = new NumberAxis(-10,10,0.1);
        final CategoryAxis statusY = new CategoryAxis();
        statusY.getStyleClass().add("chart-ai-stakeholders");
        final BarChart<Number,String> statusChart = new BarChart<Number,String>(statusX,statusY);
        
        // chart properties
        statusChart.setId("statusChart");

        //statusChart.setTitle();
        statusChart.setAlternativeColumnFillVisible(false);
        statusChart.setAlternativeRowFillVisible(false);
        statusChart.setAnimated(true);
        //statusChart.setBarGap();
        //statusChart.setCategoryGap();
        statusChart.setHorizontalGridLinesVisible(true);
        statusChart.setHorizontalZeroLineVisible(false);
        statusChart.setLegendVisible(false);
        statusChart.setVerticalGridLinesVisible(false);
        statusChart.setVerticalZeroLineVisible(true);
        statusX.setLabel("unhappy                               neutral                                 happy"); 
//        statusX.setAutoRanging(true);
        //xAxis.setLowerBound(); // x min-value !!!
        //xAxis.setUpperBound(); // x max-value !!!
        statusX.setMinorTickVisible(false);
        statusX.setSide(Side.TOP);
        statusX.setTickLabelsVisible(false);
        statusX.setTickMarkVisible(false);
        statusX.setTickLabelFill(Color.web("#f79546"));
        statusY.setTickMarkVisible(false);
        
        // chart data
        // (hoe best data dynamisch inladen? met Observable lists werken?)
        setSeries(new XYChart.Series<Number,String>());
        statusChart.getData().add(getSeries());
        
        // SCORE
        Label scoreLabel = new Label("Score");
//        scoreLabel.setPrefWidth(600);
      //1280x720
        scoreLabel.setPrefWidth(700);
        scoreLabel.setTextAlignment(TextAlignment.CENTER);
        scoreLabel.getStyleClass().add("columnLabel");
        
        HBox scoreBox = new HBox();
        scoreBox.setAlignment(Pos.TOP_CENTER);
        scoreBox.setSpacing(25);
        scoreBox.setPadding(new Insets(0, 0, 15, 0));
        
        //RISK
        VBox riskBox = new VBox();
        String riskText = "RISK: " + ((int)(riskValue*100)) + "%";
        setRiskLabel(new Label(riskText));
        getRiskLabel().getStyleClass().add("scoreLabel");
        setRiskGauge(new ImageView(generateScoreGauge(riskValue)));
        getRiskGauge().setFitWidth(160);
        getRiskGauge().setPreserveRatio(true);
        getRiskGauge().setSmooth(true);
        riskBox.getChildren().addAll(getRiskLabel(), getRiskGauge());
        riskBox.setAlignment(Pos.CENTER);
        
        // TRUST
        VBox trustBox = new VBox();
        String trustText = "TRUST: " + ((int)(trustValue*100)) + "%";
        setTrustLabel(new Label(trustText));
        getTrustLabel().getStyleClass().add("scoreLabel");
        setTrustGauge(new ImageView(generateScoreGauge(trustValue)));
        getTrustGauge().setFitWidth(160);
        getTrustGauge().setPreserveRatio(true);
        getTrustGauge().setSmooth(true);
        trustBox.getChildren().addAll(getTrustLabel(), getTrustGauge());
        trustBox.setAlignment(Pos.CENTER);
        
        //STI -> Commercial Impact
        VBox stiBox = new VBox();
        String stiText = "Commercial Impact: " + ((int)(stiValue*100)) + "%";
        setStiLabel(new Label(stiText));
        getStiLabel().getStyleClass().add("scoreLabel");
        setStiGauge(new ImageView(generateScoreGauge(stiValue)));
        getStiGauge().setFitWidth(160);
        getStiGauge().setPreserveRatio(true);
        getStiGauge().setSmooth(true);
        stiBox.getChildren().addAll(getStiLabel(), getStiGauge());
        stiBox.setAlignment(Pos.CENTER);
        
        scoreBox.getChildren().addAll(riskBox, trustBox, stiBox);
        
        resultsColumn1.getChildren().addAll(statusLabel, statusChart, scoreLabel, scoreBox);
        
        // column 2
        VBox resultsColumn2 = new VBox();
//        resultsColumn2.setPrefWidth(300);
      //1280x720
        resultsColumn2.setPrefWidth(400);
        resultsColumn2.setSpacing(10);
        
        // IMPACT
        Label impactLabel = new Label("Decision Impact");
//        impactLabel.setPrefWidth(300);
      //1280x720
        impactLabel.setPrefWidth(400);
        impactLabel.setTextAlignment(TextAlignment.CENTER);
        impactLabel.getStyleClass().add("columnLabel");
        
        VBox impactTable = new VBox();
        impactTable.setId("impactTable");
        impactTable.setPrefWidth(Double.MAX_VALUE);
        impactTable.setSpacing(8);
        impactTable.setFillWidth(true);
        
        Label impactLegend = new Label("→ pos   ← neg   • neutral");
        impactLegend.setId("impactLegend");
//        impactLegend.setPrefWidth(300);
      //1280x720
        impactLegend.setPrefWidth(400);
        impactLegend.setTextAlignment(TextAlignment.CENTER);
        
        setDecisionImpactBoxes(new ArrayList<HBox>());
//        for(int i = 0; i < Stakeholder.values().length; i++){
//        	HBox box = makeImpactRow(Stakeholder.values()[i].toString(), 0);
//        	getDecisionImpactBoxes().add(box);
//        	impactTable.getChildren().add(box);
//        }
        for(int i = 0; i < getGame().getStakeholders().size(); i++){
        	HBox box = makeImpactRow(getGame().getStakeholders().get(i).toString(), 0);
        	getDecisionImpactBoxes().add(box);
        	impactTable.getChildren().add(box);
        }
            
        // ACES LEFT
        Label acesLabel = new Label("Aces Left");
//        acesLabel.setPrefWidth(300);
      //1280x720
        acesLabel.setPrefWidth(400);
        acesLabel.setTextAlignment(TextAlignment.CENTER);
        acesLabel.getStyleClass().add("columnLabel");
        
        HBox acesLeft = new HBox(); // container for stars to center align
//        setRater(new Rater());
//        getRater().setNoOfStars(2); // number of stars (aces)
//        getRater().setRating(1); // number of stars (aces) left !!!
////        getRater().setDisable(true); // disable so user can't change number of stars
//        acesLeft.getChildren().add(getRater());
        setAcesLeftLabel(new Label());
        getAcesLeftLabel().setText("" + GameParameter.getMaxNrOfAcesPerGame());
        acesLeft.getChildren().add(getAcesLeftLabel());
        acesLeft.setAlignment(Pos.CENTER);
        
        HBox acesButtonBox = new HBox();
		Button acesButton = new Button("Choose ace");
		acesButton.setOnAction(new EventHandler<ActionEvent>(){
            @Override
            public void handle(ActionEvent arg0) {
            	closeActivePane();
            	activatePane(getActionsPane());
            }
        });
		Tooltip acesTooltip = new Tooltip("Click here to see the aces menu.\nYou can always go back to the \nresult screen without choosing an \nace by closing the aces menu.");
		acesTooltip.getStyleClass().add("tooltip");
		acesButton.setTooltip(acesTooltip);
		acesButtonBox.getChildren().add(acesButton);
		acesButtonBox.setAlignment(Pos.CENTER);
        
        resultsColumn2.getChildren().addAll(impactLabel, impactLegend, impactTable, acesLabel, acesLeft, acesButtonBox);
        
        resultsBox.getChildren().addAll(resultsColumn1, resultsColumn2);
        
        resultsWindow.getChildren().addAll(resultsTitleBar, resultsBox);
        resultsWindow.setAlignment(Pos.TOP_CENTER);
        
        getResultsPane().getChildren().add(resultsWindow);
    }

    private void generateStakeholdersAndRiskBox(){
        setStakeholdersAndRiskBox(new HBox()); // to position 2 columns next to each other
        getStakeholdersAndRiskBox().setAlignment(Pos.TOP_CENTER);
        getStakeholdersAndRiskBox().setSpacing(25);
//        getStakeholdersAndRiskBox().setMaxWidth(700);
        getStakeholdersAndRiskBox().setPadding(new Insets(15,0,15,0)); // space between title bar and content
//        getStakeholdersAndRiskBox().getStyleClass().add("popupWindow");
              
        // column 1
        VBox stakeholdersColumn = new VBox();
        stakeholdersColumn.setSpacing(10);
        
        // STAKEHOLDERS
        Label stakeholdersLabel = new Label("Stakeholders");
        stakeholdersLabel.setPrefWidth(300);
        stakeholdersLabel.setTextAlignment(TextAlignment.CENTER);
        stakeholdersLabel.getStyleClass().add("columnLabel2");
        
        stakeholdersColumn.getChildren().add(stakeholdersLabel);
        
        setStakeholderCheckBoxes(new ArrayList<StakeholderCheckBox>());
        for(Stakeholder s : getGame().getStakeholders()){
        	
        	StakeholderCheckBox c = new StakeholderCheckBox(s);
        	stakeholdersColumn.getChildren().add(c);
        	getStakeholderCheckBoxes().add(c);
        }
        
        // column 2
        VBox riskColumn = new VBox();
        riskColumn.setSpacing(10);
        
        // RISK
        Label riskLabel = new Label("Risk");
        riskLabel.setPrefWidth(300);
        riskLabel.setTextAlignment(TextAlignment.CENTER);
        riskLabel.getStyleClass().add("columnLabel2");
        riskColumn.getChildren().add(riskLabel);
        
        setToggleGroupRisk(new ToggleGroup());
        
        RiskButton r1 = new RiskButton("20 %:		low",20);
        r1.setToggleGroup(getToggleGroupRisk());
        RiskButton r2 = new RiskButton("40 %:  	medium",40);
        r2.setToggleGroup(getToggleGroupRisk());
        RiskButton r3 = new RiskButton("60 %:  	high",60);
        r3.setToggleGroup(getToggleGroupRisk());
        RiskButton r4 = new RiskButton("80 %:  	very high",80);
        r4.setToggleGroup(getToggleGroupRisk());
        
        riskColumn.getChildren().addAll(r1,r2,r3,r4);
        
        getStakeholdersAndRiskBox().getChildren().addAll(stakeholdersColumn,riskColumn);

    }
    private boolean isValidStakeholdersAndRiskChoice(){
    	boolean stakeholdersOK = false;
    	boolean riskOK = false;
    	
    	int checked = 0;
    	for(StakeholderCheckBox c : getStakeholderCheckBoxes()){
    		if(c.isSelected()){
    			checked++;
    		}
    	}
    	if(checked == 2 || checked == 3){
    		stakeholdersOK = true;
    	}
    	if(getToggleGroupRisk().getSelectedToggle() != null){
    		riskOK = true;
    	}
    	
    	if(stakeholdersOK && riskOK){
    		return true;
    	}
    	else{
    		return false;
    	}
    }
    private HBox makeImpactRow(String stakeholder, double newValue, double oldValue) {
        HBox row = new HBox();
        row.setSpacing(10);
        row.setAlignment(Pos.CENTER_LEFT);
        
        row.getStyleClass().add("impactRow");
        Label stakeholderLabel = new Label(stakeholder);
        ImageView iv = new ImageView();
        
        if((newValue - oldValue) > 0) {
            //positief
            iv = new ImageView(img_arrow_pos);        
        }
        
        if((newValue - oldValue) == 0) {
            //neutraal
            iv = new ImageView(img_neutral);        
        }
        
        if((newValue - oldValue) < 0) {
            //negatief
            iv = new ImageView(img_arrow_neg);        
        }
        
        row.getChildren().addAll(iv, stakeholderLabel);
        return row;
    }
    private HBox makeImpactRow(String stakeholder, double impactValue) {
        HBox row = new HBox();
//        row.setSpacing(10);
        //1280x720
        row.setSpacing(10);
        row.setAlignment(Pos.CENTER_LEFT);
        
        row.getStyleClass().add("impactRow");
        Label stakeholderLabel = new Label(stakeholder);

        
        row.getChildren().addAll(getArrow(impactValue), stakeholderLabel);
        return row;
    }
    private ImageView getArrow(double impactValue){
        ImageView iv = new ImageView();
        
        if(impactValue > 0) {
            //positief
            iv = new ImageView(img_arrow_pos);        
        }
        
        if(impactValue == 0) {
            //neutraal
            iv = new ImageView(img_neutral);        
        }
        
        if(impactValue < 0) {
            //negatief
            iv = new ImageView(img_arrow_neg);        
        }
        return iv;
    }
    private Image generateScoreGauge(double value) {
        int percentage = (int)(value*100);
        Image gauge = null;
                
        if(percentage <= 20) { gauge = img_20percent; }
        if((percentage > 20) && (percentage <= 40)) { gauge = img_40percent; }
        if((percentage > 40) && (percentage <= 60)) { gauge = img_60percent; }
        if((percentage > 60) && (percentage <= 80)) { gauge = img_80percent; }
        if((percentage > 80) && (percentage <= 100)) { gauge = img_100percent; }
                
        return gauge;
    }
    private void generateAnswerButtons(List<Answer> possibleAnswers){
    	removeExistingAnswerButtons();
    	
        setToggleGroupAnswers(new ToggleGroup());
//    	for(Answer answer: possibleAnswers){
//    		getAnswerBox().getChildren().add(generateAnswerButton(answer, getToggleGroup()));
//    	}
    	for(int i = 0; i < possibleAnswers.size(); i++){
    		getAnswerBox().getChildren().add(generateAnswerButton(possibleAnswers.get(i), getToggleGroupAnswers()));
    	}
    }
    private void removeExistingAnswerButtons(){
    	if(getAnswerButtons() != null){
        	getAnswerBox().getChildren().removeAll(getAnswerButtons());    		
    	}
    }
    private void displayNextDescriptionAndImage(){
        if(getActualScenario() != null){
        	if(!getActualScenario().getQuestion().equals("")){
        		displayDescriptionAndImage((getDescriptionCounter() + 1) % getActualScenario().getImages().size());
        	}
        	else{
        		displayDescriptionAndImage((getDescriptionCounter() + 1) % getActualScenario().getDescriptions().size());
        	}
        	
        }
    }
    private void displayPreviousDescriptionAndImage(){
    	if(getActualScenario() != null){
    		if(!getActualScenario().getQuestion().equals("")){
    			if(getDescriptionCounter() - 1 >= 0){
    				displayDescriptionAndImage(Math.abs((getDescriptionCounter() - 1) % getActualScenario().getImages().size()));
    			}
    		}
    		else{
    			if(getDescriptionCounter() - 1 >= 0){
    				displayDescriptionAndImage(Math.abs((getDescriptionCounter() - 1) % getActualScenario().getDescriptions().size()));
    		
    			}
    		}
    	}
    }
    private void initializeDescriptionAndImage(){
    	if(getActualScenario() != null){
    		displayDescriptionAndImage(0);
    	}
    }
    private void displayDescriptionAndImage(int index){
    		setDescriptionCounter(index);
    		if(index == getActualScenario().getDescriptions().size()){
    			System.out.println("question: " + getActualScenario().getQuestion().equals(""));
    			if(!getActualScenario().getQuestion().equals("")){
        			getScenarioTextLabel().setText(getActualScenario().getQuestion() + " (" + (getDescriptionCounter()+1) + "/" + (getActualScenario().getDescriptions().size()+1) + ")");    				
    			}
    			else{
        			getScenarioTextLabel().setText(getActualScenario().getQuestion() + " (" + (getDescriptionCounter()+1) + "/" + getActualScenario().getDescriptions().size() + ")");    				
    			}
    			generateAnswerButtons(getActualScenario().getPossibleAnswers());
    		}
    		else{
    			if(!getActualScenario().getQuestion().equals("")){
    				getScenarioTextLabel().setText(getActualScenario().getDescriptions().get(getDescriptionCounter()).getDescription() + " (" + (getDescriptionCounter()+1) + "/" + (getActualScenario().getDescriptions().size()+1) + ")");
    			}
    			else{
    				getScenarioTextLabel().setText(getActualScenario().getDescriptions().get(getDescriptionCounter()).getDescription() + " (" + (getDescriptionCounter()+1) + "/" + getActualScenario().getDescriptions().size() + ")");    					
    			}
    		}

    		changeBackground("images/", getActualScenario().getImages().get(getDescriptionCounter()).getImageName());
    		//1280x720
//    		changeBackground("images1280x720/", getActualScenario().getImages().get(getDescriptionCounter()).getImageName());
    }
    private void changeBackground(String location, String imageName){
//    	File file = new File("./imgtest/200.jpg");
//    	
//    	String image = "";
//		try {
//			image = file.toURI().toURL().toExternalForm();
//		} catch (MalformedURLException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
    	String image = getClass().getResource(location + imageName).toExternalForm();
    	
    	getContainerBP().setStyle("-fx-background-image: url('" + image + "'); 	-fx-background-size: stretch; ");
    }
    private void displayStakeholdersAndRiskBox(){
    	if(getActualScenario() != null){
    		if(getActualScenario().getQuestion().equals("") && getActualScenario().getPossibleAnswers().size() == 0){
    			if(getDescriptionCounter() == getActualScenario().getDescriptions().size() - 1){
    				generateStakeholdersAndRiskBox();
    				getScenarioBox().getChildren().add(getStakeholdersAndRiskBox());
    			}
    			else if(getScenarioBox().getChildren().contains(getStakeholdersAndRiskBox())){
    				getScenarioBox().getChildren().remove(getStakeholdersAndRiskBox());
    			}
    		}
    	}
    }
    private void removeStakeholdersAndRiskBox(){
    	if(getScenarioBox().getChildren().contains(getStakeholdersAndRiskBox())){
			getScenarioBox().getChildren().remove(getStakeholdersAndRiskBox());
		}
    }
    /* BACKEND INITIALIZATION & COMMUNICATION */
    private void initGame(){
      DataManager dm = new DataManager();
      GameStructure gs = dm.readGameStructure(1);
      List<AceCategory> categories = dm.readAceCategories();
      List<Acronym> acronyms = dm.readAcronyms();
      List<Index> indices = dm.readAllIndices();
      List<Stakeholder> stakeholders = dm.readAllStakeholders();
//      Game game = new Game(gs, categories, acronyms);
      setGame(new Game(gs, categories, acronyms, indices, stakeholders));
    }
    private void askForNextAction(){
      EventBroker.getEventBroker().fireGameStateEvent(new GameStateEvent(GameState.START_NEXT_ACTION));
    }
    private void askForCorrectiveActions(){
    	EventBroker.getEventBroker().fireGameStateEvent(new GameStateEvent(GameState.START_ACES));
    }
    private void askForAcronyms(){
    	EventBroker.getEventBroker().fireGameStateEvent(new GameStateEvent(GameState.START_ACRONYMS));
    }
    private void askForStatusOverview(){
    	EventBroker.getEventBroker().fireGameStateEvent(new GameStateEvent(GameState.START_STATUS_OVERVIEW));
    }
    private void registerDecision(Decision decision){
    	EventBroker.getEventBroker().fireDecisionEvent(new DecisionEvent(decision));
    }
	private void sendAiInfo() {
		List<Stakeholder> chosenStakeholders = new ArrayList<Stakeholder>();
		for(StakeholderCheckBox s : getStakeholderCheckBoxes()){
			if(s.isSelected()){
				chosenStakeholders.add(s.getStakeholder());
			}
		}
		
		int chosenRiskLevel = ((RiskButton) getToggleGroupRisk().getSelectedToggle()).getRisk();
		
		EventBroker.getEventBroker().fireAiInfoEvent(new AiInfoEvent(chosenStakeholders, chosenRiskLevel));
	}
	@Override
	public void processScenarioInfo(ScenarioInfoEvent event) {
		setActualScenario(event.getScenario());
		initializeDescriptionAndImage();
	}
	@Override
	public void processModuleInfo(ModuleInfoEvent event) {
		getTitleLabel().setText(event.getModule().getTitle());
	}
	@Override
	public void processAcesInfo(AcesInfoEvent event) {
		setAceCategories(event.getAceCategories());
	}
	@Override
	public void processAcronymsInfo(AcronymsInfoEvent event) {
		setAcronyms(event.getAcronyms());
	}
	@Override
	public void processGameState(GameStateEvent event) {
		switch(event.getGameState()){
			case END: 
				gameFinished = true;
				removeMenuBar();
				removeTitleBox();
				
				closeActivePane(); 
				activatePane(getEndPane()); 
//				break;
		}
	}
	@Override
	public void processStatusOverview(StatusOverviewEvent event) {
		getSeries().getData().clear();
//		for(int i = 0; i < event.getStakeholderEthicalStatus().size(); i++){
		for(int i = event.getStakeholderEthicalStatus().size()-1; i >= 0; i--){
			getSeries().getData().add(new XYChart.Data<Number,String>(event.getStakeholderEthicalStatus().get(i).getValue(), event.getStakeholderEthicalStatus().get(i).getStakeholder().toString()));
		}
		
		for(int i = 0; i < event.getIndexEthicalStatus().size(); i++){
			if(event.getIndexEthicalStatus().get(i).getIndex().getName().equals("Risk")){
				getRiskLabel().setText("RISK: " + ((int)(event.getIndexEthicalStatus().get(i).getValue()/17*100)) + "%");
				getRiskGauge().setImage(generateScoreGauge(event.getIndexEthicalStatus().get(i).getValue()/17));
			}
			else if(event.getIndexEthicalStatus().get(i).getIndex().getName().equals("Trust")){
				getTrustLabel().setText("TRUST: " + ((int)(event.getIndexEthicalStatus().get(i).getValue()*100)) + "%");
				getTrustGauge().setImage(generateScoreGauge(event.getIndexEthicalStatus().get(i).getValue()));
			}
			else if(event.getIndexEthicalStatus().get(i).getIndex().getName().equals("Short Term Impact")){
				getStiLabel().setText("Commercial Impact: " + ((int)(event.getIndexEthicalStatus().get(i).getValue()*100)) + "%");
				getStiGauge().setImage(generateScoreGauge(event.getIndexEthicalStatus().get(i).getValue()));
			}
		}
		if(event.getStakeholderImpactLastDecision() != null){
			for(int i = 0; i < event.getStakeholderImpactLastDecision().size(); i++){
				for(int j = 0; j < getDecisionImpactBoxes().size(); j++){
					Label label = (Label) getDecisionImpactBoxes().get(j).getChildren().get(1);
					if (label.getText().equals(event.getStakeholderImpactLastDecision().get(i).getStakeholder().toString())){
						getDecisionImpactBoxes().get(j).getChildren().remove(0);
						getDecisionImpactBoxes().get(j).getChildren().add(0, getArrow(event.getStakeholderImpactLastDecision().get(i).getValue()));
					}
				}
//				System.out.println(event.getStakeholderImpactLastDecision().get(i).getStakeholder() + ": " + event.getStakeholderImpactLastDecision().get(i).getValue());
			}
		}
		
		getAcesLeftLabel().setText("" + event.getNumberOfAcesLeft());
		
		updateProgressBar(event.getModuleIndex()-1, event.getNumberOfModulesToProcess()-1, event.getGameProgress());

	}
	private void updateProgressBar(int moduleIndex, int numberOfModulesToProcess, float gameProgress){
		getProgressButton().setText("Mini-game " + moduleIndex + " of " + numberOfModulesToProcess + "  ");
		getProgressBar().setProgress(gameProgress);
	}
	////////
    @Override
    public void start(Stage primaryStage) {
    	EventBroker.getEventBroker().addModuleInfoListener(this);
        EventBroker.getEventBroker().addScenarioInfoListener(this);
        EventBroker.getEventBroker().addAcesInfoListener(this);
        EventBroker.getEventBroker().addAcronymsInfoListener(this);
        EventBroker.getEventBroker().addStatusOverviewListener(this);
        EventBroker.getEventBroker().addGameStateListener(this);
        
//        initGame();
        init(primaryStage);
        
//        stage = primaryStage;

        
        primaryStage.show();
        

        
        
        //showActions();
        //showHelp();
        //showResults();
        
        //removeAllMenuButtons();
    }
    
    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }

	private Pane getActivePane() {
		return activePane;
	}

	private void setActivePane(Pane activePane) {
		this.activePane = activePane;
	}

	private BorderPane getContainerBP() {
		return containerBP;
	}

	private void setContainerBP(BorderPane containerBP) {
		this.containerBP = containerBP;
	}

	private StackPane getActionsPane() {
		return actionsPane;
	}

	private void setActionsPane(StackPane actionsPane) {
		this.actionsPane = actionsPane;
	}

	private StackPane getResultsPane() {
		return resultsPane;
	}

	private void setResultsPane(StackPane resultsPane) {
		this.resultsPane = resultsPane;
	}

	private StackPane getScenarioAnswerPane() {
		return scenarioAnswerPane;
	}

	private void setScenarioAnswerPane(StackPane scenarioAnswerPane) {
		this.scenarioAnswerPane = scenarioAnswerPane;
	}
	
	private StackPane getHelpPane() {
		return helpPane;
	}

	private void setHelpPane(StackPane helpPane) {
		this.helpPane = helpPane;
	}
	
	private void setStartPane(AnchorPane startPane) {
		this.startPane = startPane;
	}

	private AnchorPane getStartPane() {
		return startPane;
	}
	private AnchorPane getEndPane() {
		return endPane;
	}

	private void setEndPane(AnchorPane endPane) {
		this.endPane = endPane;
	}
	private HBox getMenuBox() {
		return menuBox;
	}

	private void setMenuBox(HBox menuBox) {
		this.menuBox = menuBox;
	}

	private VBox getAnswerBox() {
		return answerBox;
	}

	private void setAnswerBox(VBox answerBox) {
		this.answerBox = answerBox;
	}

	private Label getScenarioTextLabel() {
		return scenarioTextLabel;
	}

	private void setScenarioTextLabel(Label scenarioTextLabel) {
		this.scenarioTextLabel = scenarioTextLabel;
	}

	private List<Button> getAnswerButtons() {
		return answerButtons;
	}

	private void setAnswerButtons(List<Button> answerButtons) {
		this.answerButtons = answerButtons;
	}

	public ToggleGroup getToggleGroupAnswers() {
		return toggleGroupAnswers;
	}

	public void setToggleGroupAnswers(ToggleGroup toggleGroupAnswers) {
		this.toggleGroupAnswers = toggleGroupAnswers;
	}

	public void setActualScenario(Scenario actualScenario) {
		this.actualScenario = actualScenario;
	}

	public Scenario getActualScenario() {
		return actualScenario;
	}

	public void setDescriptionCounter(int descriptionCounter) {
		this.descriptionCounter = descriptionCounter;
	}

	public int getDescriptionCounter() {
		return descriptionCounter;
	}

	public void setTitleLabel(Label titleLabel) {
		this.titleLabel = titleLabel;
	}

	public Label getTitleLabel() {
		return titleLabel;
	}

	private List<AceCategory> getAceCategories() {
		return aceCategories;
	}

	private void setAceCategories(List<AceCategory> aceCategories) {
		this.aceCategories = aceCategories;
	}

	private void setAcronyms(List<Acronym> acronyms) {
		this.acronyms = acronyms;
	}

	private List<Acronym> getAcronyms() {
		return acronyms;
	}

	private void setGame(Game game) {
		this.game = game;
	}

	private Game getGame() {
		return game;
	}

	private void setTitleBox(HBox titleBox) {
		this.titleBox = titleBox;
	}

	private HBox getTitleBox() {
		return titleBox;
	}

	private XYChart.Series<Number,String> getSeries() {
		return series;
	}

	private void setSeries(XYChart.Series<Number,String> series) {
		this.series = series;
	}

	private void setRiskLabel(Label riskLabel) {
		this.riskLabel = riskLabel;
	}

	private Label getRiskLabel() {
		return riskLabel;
	}

	private void setRiskGauge(ImageView riskGauge) {
		this.riskGauge = riskGauge;
	}

	private ImageView getRiskGauge() {
		return riskGauge;
	}

	public void setTrustLabel(Label trustLabel) {
		this.trustLabel = trustLabel;
	}

	public Label getTrustLabel() {
		return trustLabel;
	}

	public void setTrustGauge(ImageView trustGauge) {
		this.trustGauge = trustGauge;
	}

	public ImageView getTrustGauge() {
		return trustGauge;
	}

	public void setStiLabel(Label stiLabel) {
		this.stiLabel = stiLabel;
	}

	public Label getStiLabel() {
		return stiLabel;
	}

	public void setStiGauge(ImageView stiGauge) {
		this.stiGauge = stiGauge;
	}

	public ImageView getStiGauge() {
		return stiGauge;
	}

	private List<HBox> getDecisionImpactBoxes() {
		return decisionImpactBoxes;
	}

	private void setDecisionImpactBoxes(List<HBox> decisionImpactBoxes) {
		this.decisionImpactBoxes = decisionImpactBoxes;
	}

//	private Rater getRater() {
//		return rater;
//	}
//
//	private void setRater(Rater rater) {
//		this.rater = rater;
//	}

	private void setAcesLeftLabel(Label acesLeftLabel) {
		this.acesLeftLabel = acesLeftLabel;
	}

	private Label getAcesLeftLabel() {
		return acesLeftLabel;
	}

	private ToggleGroup getToggleGroupAces() {
		return toggleGroupAces;
	}

	private void setToggleGroupAces(ToggleGroup toggleGroupAces) {
		this.toggleGroupAces = toggleGroupAces;
	}

	private ProgressBar getProgressBar() {
		return progressBar;
	}

	private void setProgressBar(ProgressBar progressBar) {
		this.progressBar = progressBar;
	}
	
	private Button getProgressButton() {
		return progressButton;
	}

	private void setProgressButton(Button progressButton) {
		this.progressButton = progressButton;
	}

	public void setActionsButton(Button actionsButton) {
		this.actionsButton = actionsButton;
	}

	public Button getActionsButton() {
		return actionsButton;
	}

	public void setContinueButton(Button continueButton) {
		this.continueButton = continueButton;
	}

	public Button getContinueButton() {
		return continueButton;
	}
	
	private ToggleGroup getToggleGroupRisk() {
		return toggleGroupRisk;
	}

	private void setToggleGroupRisk(ToggleGroup toggleGroupRisk) {
		this.toggleGroupRisk = toggleGroupRisk;
	}

	public List<StakeholderCheckBox> getStakeholderCheckBoxes() {
		return stakeholderCheckBoxes;
	}

	public void setStakeholderCheckBoxes(List<StakeholderCheckBox> stakeholderCheckBoxes) {
		this.stakeholderCheckBoxes = stakeholderCheckBoxes;
	}

	private HBox getStakeholdersAndRiskBox() {
		return stakeholdersAndRiskBox;
	}

	private void setStakeholdersAndRiskBox(HBox stakeholdersAndRiskBox) {
		this.stakeholdersAndRiskBox = stakeholdersAndRiskBox;
	}

	private VBox getScenarioBox() {
		return scenarioBox;
	}

	private void setScenarioBox(VBox scenarioBox) {
		this.scenarioBox = scenarioBox;
	}

}
